<template>
	<cl-select-table
		v-model="value"
		:title="t('选择病历模板')"
		:service="service.medical.template"
		:columns="columns"
		:multiple="multiple"
		:dict="{ text: 'name' }"
		pickerType="text"
	/>
</template>

<script setup lang="ts">
defineOptions({
	name: "medical-template-select",
});

import { useCool } from "/@/cool";
import { useI18n } from "vue-i18n";
import { CrudProps } from "/#/crud";
import { reactive, ref, useModel } from "vue";

const props = defineProps({
	...CrudProps,
	modelValue: null,
	multiple: Boolean,
});

const { service } = useCool();
const { t } = useI18n();

const value = useModel(props, "modelValue");

// 选项
const options = reactive({
	department: [
		{ label: t("骨科"), value: 0 },
		{ label: t("内科"), value: 1 },
		{ label: t("外科"), value: 2 },
	],
});

const columns = ref([
	{ label: t("模板名称"), prop: "name", minWidth: 140 },
	{
		label: t("适用科室"),
		prop: "department",
		minWidth: 140,
		dict: options.department,
	},
	{ label: t("创建人"), prop: "creator", minWidth: 140 },
	{
		label: t("备注"),
		prop: "remark",
		showOverflowTooltip: true,
		minWidth: 200,
	},
]);
</script>
